﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SManage.Infrastructure;
using System.Net;
using SManage.Model;

namespace SManage.TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            /* Device device;
            using (var entity = new SManageEntities()) {
                device = entity.Devices.Where(d => d.DeviceIpAddress == "127.0.0.1").First();
            }
            DeviceSyncEngine dse = new DeviceSyncEngine(device,new TimeSpan(0,0,15));
            dse.Begin();
            */
            //HostMonitor hm = new HostMonitor(IPAddress.Parse("127.0.0.1"));
            //var eh = hm.GetHostInfo().ToEasyHost();

           // var variables = new List<Variable>();
           // Messenger.Walk(VersionCode.V1, new IPEndPoint(IPAddress.Parse("192.168.10.2"), 161), new OctetString("public"),
           //     new ObjectIdentifier(".1.3.6.1.4.1.9.2.4.9.1"), variables, 10000, WalkMode.WithinSubtree);

            //var autoTopology = TopologyDiscovery.Discovery(IPAddress.Parse("192.168.21.1"));
            //IpFlowMonitor ifm = new IpFlowMonitor(IPAddress.Parse("192.168.21.1"));
            //var flow = ifm.GetAllIpFlow();

            //var device = new Device();
            //device.DeviceIpAddress = "127.0.0.1";
            //var dse = new DeviceSyncEngine(device, new TimeSpan(0, 0, 15));
            //dse.Begin();

            //var t = TopologyDiscovery.Discovery(IPAddress.Parse("173.19.33.6"));
            
            //var finder = new TraceEngine.DeviceDiscoverer();
            //finder.FoundSyncItem += (o, e) => {
            //    Console.WriteLine("Found:" + e.Item.EndPoint.Address);
            //};
            //finder.DiscoverFinished += (o, e) => {
            //    Console.WriteLine("Finished.");
            //};
            //finder.Run();

            //IpFlowMonitor flow = new IpFlowMonitor(IPAddress.Parse("192.168.99.9"));
            //while (Console.ReadLine() != "q") {
            //    var x = flow.GetAllIpFlow();
            //    foreach (var a in x) {
            //        Console.WriteLine("Byts:{0},Dst:{1},Pkts:{2},{3}Src:{4},Violation:{5}", a.ckactByts, a.ckactDst, a.ckactPkts, a.ckactSrc, a.ckactViolation);
            //    }
            //}
            HostMonitor hm = new HostMonitor(IPAddress.Parse("127.0.0.1"));
            var hi = hm.GetHostInfo();
            var ehi = hi.ToEasyHost();
            var pi = hm.GetHostProcessorInfo();
            var si = hm.GetHostStorageInfo();

                        
            Console.ReadLine();
        }
    }
}
